<?php include "../../coresection/connection.php";?>
<?php include "../../coresection/checkSession.php";?>
<?php include "../../coresection/admin-product.php";?>
<?php include "../../coresection/order-list.php";?>
<?php //include_once("function.php"); ?>
<?php include_once("detail-list-function.php"); ?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php include '../../modules/head.php'; ?>
</head>

<body>
<?php include '../../modules/topbar.php'; ?>


<div class="setup_area">


    <?php include '../../modules/sidebar-admin.php'; ?>

    <div class="header">
        <h1>满意度调查统计</h1>

        <?php include '../../modules/header.php'; ?>

    </div>





<div class="content_area feedback_box_content">




    <form action="detail-list.php" method="post" autocomplete="off" enctype="multipart/form-data"
              class="feedback_box_function">



<div>
            统计时间(开始)：<select name="start_year">
        <? if($start_year){
            ?>
            <option value="<?echo $start_year ?>"><?echo $start_year ?></option>
        <?
        }
        else
        {
        ?>
                <option value="<?echo date("Y",time())?>"><?echo date("Y",time())?></option>
        <?
        }
        ?>
                <option value="<?echo date("Y",time())-1?>"><?echo date("Y",time())-1?></option>
            </select>
            年
            <select name="start_month">

                <? if($start_month){
                    ?>
                    <option value="<?echo $start_month ?>"><?echo $start_month ?></option>
                    <?
                }
                else
                {
                    ?>
                    <option value="<?echo date("m",time())?>"><?echo date("m",time())?></option>
                    <?
                }
                ?>



                <option value="01" class="month_1">01</option>
                <option value="02" class="month_2">02</option>
                <option value="03" class="month_3">03</option>
                <option value="04" class="month_4">04</option>
                <option value="05" class="month_5">05</option>
                <option value="06" class="month_6">06</option>
                <option value="07" class="month_7">07</option>
                <option value="08" class="month_8">08</option>
                <option value="09" class="month_9">09</option>
                <option value="10" class="month_10">10</option>
                <option value="11" class="month_11">11</option>
                <option value="12" class="month_12">12</option>
            </select>
            月
            <select name="start_days">

                <? if($start_days){
                    ?>
                    <option value="<?echo $start_days ?>"><?echo $start_days ?></option>
                    <?
                }
                else
                {
                    ?>
                    <option value="<?echo date("d",time())?>"><?echo date("d",time())?></option>
                    <?
                }
                ?>


                <option value="01">01</option><option value="02">02</option><option value="03">03</option>
                <option value="04">04</option><option value="05">05</option><option value="06">06</option>
                <option value="07">07</option><option value="08">08</option><option value="09">09</option>
                <option value="10">10</option><option value="11">11</option><option value="12">12</option>
                <option value="13">13</option><option value="14">14</option><option value="15">15</option>
                <option value="16">16</option><option value="17">17</option><option value="18">18</option>
                <option value="19">19</option><option value="20">20</option><option value="21">21</option>
                <option value="22">22</option><option value="23">23</option><option value="24">24</option>
                <option value="25">25</option><option value="26">26</option><option value="27">27</option>
                <option value="28">28</option><option value="29">29</option><option value="30">30</option>
                <option value="31">31</option>
            </select>
            日

<div class="function">
    <input type="submit" value="统计" class="layui-btn"  />
</div>

</div>

<!--            <div>-->
<!--            统计时间(结束)：<select name="end_year">-->
<!--                <option value="--><?//echo date("Y",time())?><!--">--><?//echo date("Y",time())?><!--</option>-->
<!--                <option value="--><?//echo date("Y",time())-1?><!--">--><?//echo date("Y",time())-1?><!--</option>-->
<!--            </select>-->
<!--            年-->
<!--            <select name="end_month">-->
<!--                <option value="--><?//echo date("m",time())?><!--">--><?//echo date("m",time())?><!--</option>-->
<!--                <option value="01" class="month_1">01</option>-->
<!--                <option value="02" class="month_2">02</option>-->
<!--                <option value="03" class="month_3">03</option>-->
<!--                <option value="04" class="month_4">04</option>-->
<!--                <option value="05" class="month_5">05</option>-->
<!--                <option value="06" class="month_6">06</option>-->
<!--                <option value="07" class="month_7">07</option>-->
<!--                <option value="08" class="month_8">08</option>-->
<!--                <option value="09" class="month_9">09</option>-->
<!--                <option value="10" class="month_10">10</option>-->
<!--                <option value="11" class="month_11">11</option>-->
<!--                <option value="12" class="month_12">12</option>-->
<!--            </select>-->
<!--            月-->
<!--            <select name="end_days">-->
<!--                <option value="--><?//echo date("d",time())?><!--">--><?//echo date("d",time())?><!--</option>-->
<!--                <option value="01">01</option><option value="02">02</option><option value="03">03</option>-->
<!--                <option value="04">04</option><option value="05">05</option><option value="06">06</option>-->
<!--                <option value="07">07</option><option value="08">08</option><option value="09">09</option>-->
<!--                <option value="10">10</option><option value="11">11</option><option value="12">12</option>-->
<!--                <option value="13">13</option><option value="14">14</option><option value="15">15</option>-->
<!--                <option value="16">16</option><option value="17">17</option><option value="18">18</option>-->
<!--                <option value="19">19</option><option value="20">20</option><option value="21">21</option>-->
<!--                <option value="22">22</option><option value="23">23</option><option value="24">24</option>-->
<!--                <option value="25">25</option><option value="26">26</option><option value="27">27</option>-->
<!--                <option value="28">28</option><option value="29">29</option><option value="30">30</option>-->
<!--                <option value="31">31</option>-->
<!--            </select>-->
<!--            日-->
<!--</div>-->



 </form>




<!--统计信息-->
<div class="feedbackbox_content">

    <div>
        平均分值: <?
                  $count_point=array_sum($q1)/count($q1)+
                  array_sum($q2)/count($q2)+
                  array_sum($q3)/count($q3)+
                  array_sum($q4)/count($q4)+
                  array_sum($q5)/count($q5)+
                  array_sum($q6)/count($q6)+
                  array_sum($q7)/count($q7)+
                  array_sum($q8)/count($q8)+
                  array_sum($q9)/count($q9)+
                  array_sum($q10)/count($q10);

                  echo floor($count_point*100)/100

               ?>
    </div>

<div>参与调查人数：<? echo $sum ?></div>


    <div>
    <?php

    function mostRepeatedValues($array,$length=0){
        if(empty($array) or !is_array($array)){
            return false;
        }
        //1. 计算数组的重复值
        $array = array_count_values($array);
        //2. 根据重复值 倒排序
        arsort($array);
        if($length>0){
            //3. 返回前 $length 重复值
            $array = array_slice($array, 0, $length, true);
        }
        return $array;
    }

    $counts_num=mostRepeatedValues($full_best_meal,5);
    $counts_num_new =array_values($counts_num);
    $counts_name=array_keys($counts_num);

    ?>

        最喜欢的菜式（前三名）：
        1.<? echo $counts_name[0] ;?>(<? echo $counts_num_new[0]?>) /
        2.<? echo $counts_name[1] ;?>(<? echo $counts_num_new[1]?>) /
        3.<? echo $counts_name[2] ;?>(<? echo $counts_num_new[2]?>)

    </div>

    <div>

        <?php

        $counts_num=mostRepeatedValues($full_worst_meal,5);
        $counts_num_new =array_values($counts_num);
        $counts_name=array_keys($counts_num);

        ?>

        不喜欢的菜式（前三名）：
        1.<? echo $counts_name[0] ;?>(<? echo $counts_num_new[0]?>) /
        2.<? echo $counts_name[1] ;?>(<? echo $counts_num_new[1]?>) /
        3.<? echo $counts_name[2] ;?>(<? echo $counts_num_new[2]?>)


    </div>
<!--统计信息-->








<!--详细选项数-->
<div class="option-result">


<h5>详细选项数</h5>


        <ol class="detail-boxing">


            <li class="q1">


                <h6>你经常在我单位饭堂就餐吗？</h6>

                <div class='radio-box'>

                    <label ><span>每次都在(<? echo $full_q1_new['10']; ?> 人)</span> </label>


                    <label ><span>基本在(<? echo $full_q1_new['8']; ?> 人)</span></label>


                    <label ><span>偶尔在(<? echo $full_q1_new['6']; ?> 人)</span></label>

                    <label ><span>从不(<? echo $full_q1_new['0']; ?> 人)</span></label>
                </div>


            </li>




            <li class="q2">


                <h6>你觉得食堂的饭菜价格怎样？</h6>

                <div class='radio-box'>
                    <label ><span>可以接受(<? echo $full_q2_new['10']; ?> 人)</span></label>

                    <label   ><span>比较便宜(<? echo $full_q2_new['8']; ?> 人)</span></label>

                    <label    ><span>一般(<? echo $full_q2_new['6']; ?> 人)</span></label>

                    <label  ><span>很贵(<? echo $full_q2_new['0']; ?> 人)</span></label>
                </div>


            </li>



            <li class="q3">


                <h6>你对食堂的卫生情况是否满意</h6>

                <div class='radio-box'>
                    <label  ><span>满意(<? echo $full_q31_new['10']; ?> 人)</span></label>

                    <label  ><span>较满意(<? echo $full_q3_new['8']; ?> 人)</span></label>

                    <label ><span>一般(<? echo $full_q3_new['6']; ?> 人)</span></label>

                    <label   ><span>不满意(<? echo $full_q3_new['0']; ?> 人)</span></label>
                </div>


            </li>





            <li class="q4">


                <h6>你对饭菜的味道是否满意</h6>

                <div class='radio-box'>
                    <label  ><span>满意(<? echo $full_q4_new['10']; ?> 人)</span></label>

                    <label  ><span>较满意(<? echo $full_q4_new['8']; ?> 人)</span></label>

                    <label  ><span>一般(<? echo $full_q4_new['6']; ?> 人)</span></label>

                    <label ><span>不满意(<? echo $full_q4_new['0']; ?> 人)</span></label>
                </div>


            </li>





            <li class="q5">


                <h6>你对饭菜的份量是否满意？</h6>

                <div class='radio-box'>
                    <label  ><span>满意(<? echo $full_q5_new['10']; ?> 人)</span></label>

                    <label  ><span>较满意(<? echo $full_q5_new['8']; ?> 人)</span></label>

                    <label  ><span>一般(<? echo $full_q5_new['6']; ?> 人)</span></label>

                    <label  ><span>不满意(<? echo $full_q5_new['0']; ?> 人)</span></label>
                </div>


            </li>




            <li class="q6">


                <h6>你对饭菜的种类是否满意？</h6>

                <div class='radio-box'>
                    <label  ><span>满意(<? echo $full_q6_new['10']; ?> 人)</span></label>

                    <label   ><span>较满意(<? echo $full_q6_new['8']; ?> 人)</span></label>

                    <label   ><span>一般(<? echo $full_q6_new['6']; ?> 人)</span></label>

                    <label   ><span>不满意(<? echo $full_q6_new['0']; ?> 人)</span></label>
                </div>


            </li>





            <li class="q7">


                <h6>你对送餐（打饭）的速度是否满意？</h6>

                <div class='radio-box'>
                    <label ><span>满意(<? echo $full_q7_new['10']; ?> 人)</span></label>

                    <label ><span>较满意(<? echo $full_q7_new['8']; ?> 人)</span></label>

                    <label ><span>一般(<? echo $full_q7_new['6']; ?> 人)</span></label>

                    <label ><span>不满意(<? echo $full_q7_new['0']; ?> 人)</span></label>
                </div>


            </li>




            <li class="q8">


                <h6>你对汤类的质量是否满意？</h6>

                <div class='radio-box'>
                    <label ><span>满意(<? echo $full_q8_new['10']; ?> 人)</span></label>

                    <label ><span>较满意(<? echo $full_q8_new['8']; ?> 人)</span></label>

                    <label ><span>一般(<? echo $full_q8_new['6']; ?> 人)</span></label>

                    <label ><span>不满意(<? echo $full_q8_new['0']; ?> 人)</span></label>
                </div>


            </li>




            <li class="q9">


                <h6>你对服务员的态度是否满意？</h6>

                <div class='radio-box'>
                    <label ><span>满意(<? echo $full_q9_new['10']; ?> 人)</span></label>

                    <label ><span>较满意(<? echo $full_q9_new['8']; ?> 人)</span></label>

                    <label ><span>一般(<? echo $full_q9_new['6']; ?> 人)</span></label>

                    <label ><span>不满意(<? echo $full_q9_new['0']; ?> 人)</span></label>
                </div>


            </li>




            <li class="q10">


                <h6>你对食堂的总体评价如何？</h6>

                <div class='radio-box'>
                    <label    ><span>好(<? echo $full_q10_new['10']; ?> 人)</span></label>

                    <label    ><span>较好(<? echo $full_q10_new['8']; ?> 人)</span></label>

                    <label    ><span>一般(<? echo $full_q10_new['6']; ?> 人)</span></label>

                    <label   ><span>不好(<? echo $full_q10_new['0']; ?> 人)</span></label>
                </div>


            </li>






        </ol>
    </div>













<div class="option-result2">


    <table class="layui-table">
        <colgroup>
            <col >
            <col >
            <col >
            <col >
            <col>
        </colgroup>
        <thead>
        <tr>
            <td class="name">名称</td>
            <td class="point">总评分</td>
            <td class="hate_meal">喜欢菜式</td>
            <td class="like_meal">讨厌菜式</td>
            <td class="datetime">输入时间</td>
            <td class="remark">建议意见</td>
            <td class="function">操作</td>
        </tr>
        </thead>

        <tbody>



        <?php for ($i = 0; $i < $detailnum; $i++) { ?>


                <tr>

                    <td class="name">
                        <?php echo $user2_id[$i] ?> / <?php echo $user2_name[$i] ?>
                    </td>

                    <td class="point"><? echo $q1[$i]+$q2[$i]+$q3[$i]+$q4[$i]+$q5[$i]+$q6[$i]+$q7[$i]+$q8[$i]+$q9[$i]+$q10[$i] ?></td>


                    <td class="hate_meal">
                        <?php if(!$best_meal[$i]){echo "/";} else {echo $best_meal[$i];}?>
                    </td>

                    <td class="like_meal">
                        <?php if(!$worst_meal[$i]){echo "/";} else {echo $worst_meal[$i];}?>
                    </td>



                    <td class="datetime">
                        <?php echo $datetime[$i] ?>
                    </td>



                    <td class="remark"><?php echo substr($remark[$i],0,40) ?>...</td>
                    <td class="function"><a href="detail-edit.php?nid=<?echo $nid[$i]?>">查看</a></td>

                </tr>




            <?php

        }
        ?>


        </tbody>
    </table>

    <?php

    if ($detailnum == 0) {
        echo " <div>暂无资料。数据添加中</div>";
    }

    ?>




</div>






<div class="list-box-function" <? if ($detailnum == 0) {
    echo "style" . "='display:none'";
} ?> >
    <div class="page-guide">

        <?php
        if ($nowpageid == 1) {
            ?>
            <!--现在页数在第一页的时候-->
            <span>首页</span>
            <span>前一页</span>
            <!--现在页数非第一页的时候-->
        <?php
        } else {
            ?>
            <!--现在页数非第一页的时候-->
            <a href="detail-list.php?sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>">首页</a>
            <a href="detail-list.php?nowpageid=<?php echo $prepage; ?>&sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>">前一页</a>
            <!--现在页数非第一页的时候-->
        <?php
        }
        ?>


        <!--开始列印出所有页码-->

        <?php
        $ii = 1;
        $iii = 1;

        while ($ii <= $page_count) {
            //首先判断是不是当前页

            if ($ii == $nowpageid) {
                echo "<span>" . $ii . "</span>";
            } else if ((($ii + 5) < $nowpageid) || (($ii - 5) > $nowpageid)) {
            } else {
                echo "<a href='";
                echo "detail-list.php?nowpageid=";
                echo $iii;
                echo "&sortby=";
                echo $sort_by;
                echo "&nid=";
                echo $trans_nid;
                echo "&sys_part=";
                echo $system_part;
                echo "'>";
                echo $iii;
                echo "</a>";
            }

            $ii++;
            $iii++;
        }
        ?>

        <!--列印出所有页码 结束-->


        <?php
        if ($nowpageid == $page_count) {
            ?>
            <!--现在页数在第一页的时候-->
            <span>后一页</span>
            <span>末页</span>
            <!--现在页数非第一页的时候-->
        <?php
        } else {
            ?>
            <!--现在页数非第一页的时候-->
            <a href="detail-list.php?nowpageid=<?php echo $nextpage; ?>&sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>">后一页</a>
            <a href="detail-list.php?nowpageid=<?php echo $lastpage; ?>&sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>">末页</a>
            <!--现在页数非第一页的时候-->
        <?php
        }
        ?>


    </div>
</div>
<!--翻页代码结束-->



<!--list-box end-->
</div>




</div>

    <?php include '../../modules/footer.php'; ?>
</body>
</html>
